package offer;

public class offer_0024 {
    public ListNode reverseList(ListNode head) {
        int[] num=new int[5000];
        int len=0;
        ListNode p=head;
        while(p!=null){
            num[len]=p.val;
            len++;
            p=p.next;
        }
        p=head;
        for(int i=len-1;i>=0;--i){
            p.val=num[i];
            p=p.next;
        }
        return head;
    }
}
